import time, uuid

from orm import Model, StringField, BooleanField, FloatField, TextField,IntegerField

# def next_id():
#     return '%015d%s000' % (int(time.time() * 1000), uuid.uuid4().hex)

# class User(Model):
#     __table__ = 'users'
#
#     id = StringField(primary_key=True, default=next_id, ddl='varchar(50)')
#     email = StringField(ddl='varchar(50)')
#     passwd = StringField(ddl='varchar(50)')
#     admin = BooleanField()
#     name = StringField(ddl='varchar(50)')
#     image = StringField(ddl='varchar(500)')
#     created_at = FloatField(default=time.time)

class StoreBook(Model):
    __table__ = 'store_book'

    id = IntegerField(primary_key=True,ddl='int(11)')
    bookname = StringField(ddl='VARCHAR(45)')
    author = StringField(ddl='VARCHAR(45)')
    click_num = IntegerField(ddl='int(11)')
    write_num = IntegerField(ddl='int(11)')

class StoreChapter(Model):
    __table__ = 'store_chapter'

    id = IntegerField(primary_key=True,ddl='int(11)')
    book_id = IntegerField(ddl='int(11)')
    chapter_name = StringField(ddl='VARCHAR(100)')
    article_url = StringField(ddl='VARCHAR(500)')


class Novel(Model):
    __table__ = 'novel'

    id = IntegerField(primary_key=True,ddl='int(11)')
    novel_name = StringField(ddl='VARCHAR(50)')
    type = IntegerField(ddl='TINYINT(2)')
    is_free = IntegerField(ddl='TINYINT(2)')
    is_end = IntegerField(ddl='TINYINT(1)')
    author = StringField(ddl='VARCHAR(50)')
